package com.service.impl;

import com.entity.School;
import com.mapper.SchoolMapper;
import com.service.SchoolService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Data
@Service
public class SchoolServiceImpl implements SchoolService {
    @Autowired
    private SchoolMapper schoolMapper;

    @Override
    // 查询所有学校信息
    public List<School> selectAllSchools() {
        return schoolMapper.selectAllSchools();
    }

    @Override
    // schoolName 查询学校信息
    public List<School> selectSchoolBySchoolName(String schoolName) {
        return schoolMapper.selectSchoolBySchoolName(schoolName);
    }

    @Override
    // id 查询学校信息
    public School selectSchoolBySchoolId(int schoolId) {
        return schoolMapper.selectSchoolBySchoolId(schoolId);
    }

    @Override
    // id 删除学校信息
    public int deleteSchoolBySchoolId(int schoolId) {
        return schoolMapper.deleteSchoolBySchoolId(schoolId);
    }

    @Override
    // 新增学校信息
    public int insertSchool(School school) {
        return schoolMapper.insertSchool(school );
    }

    @Override
    // 修改学校信息
    public int updateSchool(School school) {
        return schoolMapper.updateSchool(school);
    }
}
